// pages/thetext/thetext.js
var util = require("../../utils/util.js")
var api = require("../../utils/api.js")
var app = getApp();
var WxParse = require('../../utils/wxParse/wxParse.js');
Page({

    /**
     * 页面的初始数据
     */
    data: {
        // type:0,
        info: {},
        resBaseUrl: '',
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        console.log(options)
        if (options.type == 1) {
            var that = this
            that.setData({
                // info: res.data,
                //  type:type,
                resBaseUrl: app.globalData.resBaseUrl,
            })
            let data = { id: options.id }
            let url = app.globalData.resBaseUrl + app.u.TESTINFO
            api.requestUrl(data, url).then(res => {
                that.setData({
                    info: res.data,
                    // type:type,
                })
            })
        } else {
            var that = this
            that.setData({
                resBaseUrl: app.globalData.resBaseUrl,
            })
            let data = { id: options.id }
            let url = app.globalData.resBaseUrl + app.u.CLASSINFO
            api.requestUrl(data, url).then(res => {
                that.setData({
                    info: res.data,
                    // type:type,
                })
            })
        }

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

        wx.showShareMenu({
            withShareTicket: true
        })
    },
})